/**
 * 
 */
package valverde.nacho.stripes;

import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.ForwardResolution;
import net.sourceforge.stripes.action.RedirectResolution;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.SimpleMessage;

/**
 * @author ignacio.canon@entelgy.com
 */
public class ContactFormActionBean extends MyActionBeanBase {
    @DefaultHandler
    public Resolution newcontact() {
	return new ForwardResolution(FORM);
    }

    public Resolution save() {
	getContactDao().save(getContact());
	getContext().getMessages().add(new SimpleMessage("{0} has been saved.", getContact()));
	return new RedirectResolution(ContactListActionBean.class);
    }

    public Resolution cancel() {
	getContext().getMessages().add(new SimpleMessage("Action cancelled."));
	return new RedirectResolution(ContactListActionBean.class);
    }
}
